package com.biqee.framework.interceptor;

import com.biqee.framework.context.RequestContext;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.interceptor.Interceptor;

/**
 * 用来清理用户上下文的拦截器，所有的用户请求都需要经过本拦截器，并且本拦截器需要在其他拦截器之前加载
 * @author guotao.tangt
 *
 */
public class RequestContextInterceptor implements Interceptor {

	private static final long serialVersionUID = -1494397756703958458L;

	@Override
	public void destroy() {

	}

	@Override
	public void init() {
	}

	@Override
	public String intercept(ActionInvocation actionInvocation) throws Exception {
		try {
			return actionInvocation.invoke();			
		} finally {
			RequestContext.clear();
		}
	}

}
